//
//  LGDownloadManager.h
//  LGNetworkDemo
//
//  Created by dangwc on 2019/5/15.
//  Copyright © 2019 dangwc. All rights reserved.
//

#import <Foundation/Foundation.h>
typedef NS_ENUM(NSUInteger, TSDownloadMode) {
    TSDownloadModeSingleDownload,//仅仅是下载文件操作
    TSDownloadModeBreakpointResume,//下载支持断点下载
};

NS_ASSUME_NONNULL_BEGIN

@interface LGDownloadManager : NSObject

/**
 初始化方法

 @param downloadMode 下载模式
 @return LGDownloadManager
 */
-(instancetype)initWithDownloadModel:(TSDownloadMode)downloadMode;



/**
 开启下载操作

 @param requestUrl 下载链接
 @param localFilesPath 下载文件的存放路径
 @param fileID 文件名称
 @param downloadProgressBlock 进度
 @param seccess 成功回调
 @param failure 失败回调
 */
-(void)downloadDataWithRequestUrl:(NSString *)requestUrl
                        filesPath:(NSString *)localFilesPath
                           fileID:(NSString *)fileID
                         progress:(void (^)(double progress))downloadProgressBlock
                          seccess:(void (^)(NSURL *url))seccess
                          failure:(void (^)(NSError *error))failure;

/**
 继续下载
 */
-(void)resumeDownload;

/**
 暂停下载
 */
-(void)suspendDownload;

/**
 取消下载
 */
-(void)cancelDownload;


@end

NS_ASSUME_NONNULL_END
